#ifndef SMELTINGCONFIGWIDGET_H
#define SMELTINGCONFIGWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QButtonGroup>
#include <QFrame>

#include "ConfigItemWidget.h"
#include "SteelClientDataProvider.h"

class SmeltingConfigWidget : public QWidget
{
    Q_OBJECT

public:
    explicit SmeltingConfigWidget(QWidget *parent = nullptr);
    ~SmeltingConfigWidget();

public slots:
    void loadDataForStove(int stoveIndex);

private slots:
    void onEditButtonClicked();
    void onSubmitButtonClicked();
    void onWorkingConditionValueChanged(const QString &name, const QString &value);
    void onOxygenLanceValueChanged(const QString &name, const QString &value);
    void onMaterialValueChanged(const QString &name, const QString &value);

private:
    void setupUI();
    void setupConnections();
    void setupWorkingConditionPanel();
    void setupOxygenLancePanel();
    void setupMaterialPanel();
    void setupOtherPanel();
    void setupBottomButtons();
    void setEditMode(bool enabled);
    void updateWorkingConditionData();
    void updateOxygenLanceData();
    void updateMaterialData();
    double parseDouble(const QString &str) const;
    int parseInt(const QString &str) const;

    QVBoxLayout *m_mainLayout;
    QHBoxLayout *m_panelsLayout;
    QHBoxLayout *m_bottomLayout;

    ConfigItemWidget *m_workingConditionPanel;
    ConfigItemWidget *m_oxygenLancePanel;
    ConfigItemWidget *m_materialPanel;
    ConfigItemWidget *m_otherPanel;

    QPushButton *m_editButton;
    QPushButton *m_submitButton;

    bool m_isEditMode;
    int m_currentStoveIndex;
};

#endif // SMELTINGCONFIGWIDGET_H
